<?php /* Smarty version 2.6.20, created on 2016-07-19 15:22:41
         compiled from express_paper_print.htm */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 'date_format', 'express_paper_print.htm', 128, false),)), $this); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>发货订单</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="admin.css" rel="stylesheet" type="text/css" />
<link href="cxcalendar.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../script/jquery-1.4.4.min.js"></script>
<script language="javascript" src="../script/Calendar-new.js"></script>
<script type="text/javascript">
function import_express(){
    window.parent.iframe_form("importexpress", '上传导入文件', '<?php echo $this->_tpl_vars['config']['weburl']; ?>
/admin/module.php?m=product&s=express_paper_print.php&act=importexpress', 300,300);
    return false;
}
</script>
</head>
<body>
<div class="container">
    <div class="flow">
        <div class="itemtitle">
            <h3>邮政小包订单</h3>
            <ul>
                <li class="current"><a href="?m=<?php echo $_GET['m']; ?>
&s=<?php echo $_GET['s']; ?>
"><span>管理</span></a></li>
            </ul>
            <ul style="float:right;">
                <li>
                    <form method="post" target="export_iframe_1" id="export_form_1" action=""><input type="hidden" value="export_oid_eid" name="act"/></form>
                    <iframe src="" style="display:none;" id="export_iframe_1" name="export_iframe_1"></iframe>
                    <a href="javascript:;" onclick="$('#export_form_1').submit();"><span>导出订单号/运单号</span></a>
                </li>
                <li>
                    <form method="post" target="export_iframe" id="export_form" action=""><input type="hidden" value="export" name="act"/></form>
                    <iframe src="" style="display:none;" id="export_iframe" name="export_iframe"></iframe>
                    <a href="javascript:;" onclick="$('#export_form').submit();"><span>导出EXCEL</span></a>
                </li>
                <li><a href="javascript:;" onclick="import_express();"><span>导入运单号</span></a></li>
                <li>
                    <form method="post" target="export_customs_iframe" id="export_customs_form" action=""><input type="hidden" value="export_customs" name="act"/></form>
                    <iframe src="" style="display:none;" id="export_customs_iframe" name="export_customs_iframe"></iframe>
                    <a href="javascript:;" onclick="$('#export_customs_form').submit();"><span>导出海关申报数据</span></a>
                </li>
            </ul>
        </div>
    </div>
    <div class="h35"></div>
    <form action="" method="get">
    <input type="hidden" name="m" value="<?php echo $_GET['m']; ?>
">
    <input type="hidden" name="s" value="express_paper_print.php">
    <table class="select_table">
        <tr>    
            <td>
                <div class="select_box">
                    <select name="stock_shop" id="stock_shop" style="float:left;">
	                <option value="" <?php if ($this->_tpl_vars['general_shop'] != 0): ?>disabled<?php endif; ?>>全部</option>
	                <?php $_from = $this->_tpl_vars['stock_shops']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['list']):
?>
	                <option value="<?php echo $this->_tpl_vars['list']['id']; ?>
" <?php if ($_GET['stock_shop'] == $this->_tpl_vars['list']['id']): ?>selected<?php endif; ?> <?php if ($this->_tpl_vars['general_shop'] != 0 && $this->_tpl_vars['general_shop'] != $this->_tpl_vars['list']['id']): ?>disabled<?php endif; ?>><?php echo $this->_tpl_vars['list']['title']; ?>
</option>
	                
	                <?php endforeach; endif; unset($_from); ?>
	                </select>
	                <input placeholder="请输入订单编号..." type="text" name="code" class="w180" value="<?php echo $_GET['code']; ?>
"  />
	            </div>
           </td>
           <td>
                    <span>&nbsp;打印状态:</span>
                    <span><select name="express_print_status"><option value="" <?php if (! $_GET['express_print_status'] && $_GET['express_print_status'] != '0'): ?>selected<?php endif; ?> >不限</option><option value="0" <?php if ($_GET['express_print_status'] == '0'): ?>selected<?php endif; ?> >未打印</option><option value="1" <?php if ($_GET['express_print_status'] && $_GET['express_print_status'] == '1'): ?>selected<?php endif; ?> >已打印</option></select></span>
                    <span>&nbsp;导出状态:</span>
                    <span><select name="express_export_status"><option value="" <?php if (! $_GET['express_export_status'] && $_GET['express_export_status'] != '0'): ?>selected<?php endif; ?> >不限</option><option value="0" <?php if ($_GET['express_export_status'] == '0'): ?>selected<?php endif; ?> >未导出</option><option value="1" <?php if ($_GET['express_export_status'] && $_GET['express_export_status'] == '1'): ?>selected<?php endif; ?> >已导出</option></select></span>
                    <span>&nbsp;订单状态:</span>
                    <span><select name="status"><option value="">不限</option><option value="2" <?php if ($_GET['status'] == '2'): ?>selected<?php endif; ?> >未发货</option><option value="3" <?php if ($_GET['status'] == '3'): ?>selected<?php endif; ?> >已发货</option><option value="4" <?php if ($_GET['status'] == '4'): ?>selected<?php endif; ?> >已完成</option></select></span>
                    <span>&nbsp;发货时间：</span>
                    <span>
                            <input class="w120 input_cxcalendar" type="text" name="s_stime" id="s_stime" value="<?php echo $_GET['s_stime']; ?>
">
                            -
                            <input class="w120 input_cxcalendar" type="text" name="s_etime" id="s_etime" value="<?php echo $_GET['s_etime']; ?>
">
                    </span>
                    <span>&nbsp;打单时间：</span>
                    <span>
                            <input class="w120 input_cxcalendar" type="text" name="p_stime" id="p_stime" value="<?php echo $_GET['p_stime']; ?>
">
                            -
                            <input class="w120 input_cxcalendar" type="text" name="p_etime" id="p_etime" value="<?php echo $_GET['p_etime']; ?>
">
                    </span>
           </td>
        </tr>
        <tr>
        	<td>
           		<span>&nbsp;运单号:</span>
           		<span><textarea name="shipping_no" style="resize:horizontal;height:30px;" placeholder="多个请用英文逗号隔开"><?php echo $_GET['shipping_no']; ?>
</textarea></span>
            </td>
            <td>
                <input type="submit" value="搜索" />
            </td>
        </tr>
    </table>
    </form>
    <table class="table product">
       <tbody>
       <tr class="header">
            <th width="30">查看</th>
            <th width="60">操作</th>
            <th width="60">打印</th>
            <th width="60">打印状态</th>
            <th width="100">订单编号</th>
            <th width="60">导出状态</th>
            <th width="60">订单状态</th>
            <th width="60">重量</th>
            <th width="60">运费</th>
            <th width="60">行邮税</th>
            <th width="100">快递类型</th>
            <th width="100">快递单号</th>
            <th width="100">下单时间</th>
            <th width="100">发货时间</th>
            <th width="100">打单时间</th>
        </tr>
        <?php $_from = $this->_tpl_vars['de']['list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['list']):
?>
        <tr>
            <td><a href="?m=product&s=order_detail.php&oid=<?php echo $this->_tpl_vars['list']['order_id']; ?>
"><?php echo $this->_tpl_vars['lookimg']; ?>
</a></td>
            <td><?php if ($this->_tpl_vars['list']['status'] == 3): ?>已发货<?php else: ?><a class="a-opear" data-type="ship" data-param="{'id':'<?php echo $this->_tpl_vars['list']['order_id']; ?>
'}" href="#">发货</a><?php endif; ?></td>
            <td><?php if ($this->_tpl_vars['list']['shipping_no']): ?><a class="a-opear" data-type="expressprint" data-param="{'id':'<?php echo $this->_tpl_vars['list']['order_id']; ?>
','express_print_status':'<?php echo $this->_tpl_vars['list']['express_print_status']; ?>
'}" href="#">运单</a><?php else: ?><span stype="color:gray;">运单</span><?php endif; ?></td>
            <td><?php if ($this->_tpl_vars['list']['express_print_status'] == 1): ?><span style="color:red;">已打印</span><?php else: ?><span style="color:green;">未打印</span><?php endif; ?></td>
            <td><?php echo $this->_tpl_vars['list']['order_id']; ?>
<?php if ($this->_tpl_vars['list']['order_type'] == 2): ?><b>(分销订单)</b><?php endif; ?><?php if ($this->_tpl_vars['list']['order_type'] == 3): ?><b>(微店订单)</b><?php endif; ?></td>
            <td><?php if ($this->_tpl_vars['list']['express_export_status'] == 1): ?>已导出<?php else: ?>未导出<?php endif; ?></td>
            <td><?php if ($this->_tpl_vars['list']['status'] == 3): ?>已发货<?php elseif ($this->_tpl_vars['list']['status'] == 4): ?>已完成<?php else: ?>未发货<?php endif; ?></td>
            <td><?php if ($this->_tpl_vars['list']['shipping_weight']): ?><?php echo $this->_tpl_vars['list']['shipping_weight']; ?>
KG<?php endif; ?></td>
            <td><?php echo $this->_tpl_vars['config']['money']; ?>
<?php echo $this->_tpl_vars['list']['shipping_freight_rmb']; ?>
</td>
            <td><?php echo $this->_tpl_vars['config']['money']; ?>
<?php echo $this->_tpl_vars['list']['tax_price']; ?>
</td>
            <td><?php echo $this->_tpl_vars['list']['shipping_express_name']; ?>
</td>
            <td><?php echo $this->_tpl_vars['list']['shipping_no']; ?>
</td>
            <td><?php echo ((is_array($_tmp=$this->_tpl_vars['list']['order_time'])) ? $this->_run_mod_handler('date_format', true, $_tmp, "%Y-%m-%d&nbsp;%H:%M:%S") : smarty_modifier_date_format($_tmp, "%Y-%m-%d&nbsp;%H:%M:%S")); ?>
</td>
            <td><?php echo ((is_array($_tmp=$this->_tpl_vars['list']['ship_time'])) ? $this->_run_mod_handler('date_format', true, $_tmp, "%Y-%m-%d&nbsp;%H:%M:%S") : smarty_modifier_date_format($_tmp, "%Y-%m-%d&nbsp;%H:%M:%S")); ?>
</td>
            <td><?php echo ((is_array($_tmp=$this->_tpl_vars['list']['express_print_time'])) ? $this->_run_mod_handler('date_format', true, $_tmp, "%Y-%m-%d&nbsp;%H:%M:%S") : smarty_modifier_date_format($_tmp, "%Y-%m-%d&nbsp;%H:%M:%S")); ?>
</td>
        </tr>
        <?php endforeach; else: ?>
        <tr>
            <td class="norecord" colspan="99"><i></i><span>暂无符合条件的数据记录</span></td>
        </tr>
        <?php endif; unset($_from); ?>
        </tbody>
        <tfoot>
            <tr>
                <td colspan="99">
                    <div class="fl">每页最多显示： 20条</div>
                    <div class="page"><?php echo $this->_tpl_vars['de']['page']; ?>
</div>
                    <div class="fr">共有<?php echo $this->_tpl_vars['de']['count']; ?>
条记录</div>
                </td>
            </tr>
        </tfoot>
    </table>
<script>
$(".a-opear").live('click',function(){
    
    var data = $(this).attr('data-param');
    eval("data = "+data);
    var type = $(this).attr('data-type');
    if(!data.id)
    {
        error('error','对不起，请选择订单后操作！');
        return false;
    }
   if(type=='expressprint'){
       var flag = false;
       var express_print_status = false;
       if(data.express_print_status=='1'){
           flag = confirm('已经打印过该订单，确认打印？');
           express_print_status = true;
       }
       if(express_print_status && !flag){
           return false;
       }
        //window.parent.iframe_form("expressprint", '快递单打印', '<?php echo $this->_tpl_vars['config']['weburl']; ?>
/admin/module.php?m=logistics&s=print.php&type=expressprint&oid='+data.id, 850,500);
        printArea(data.id);
    
        return false;
    }
    window.parent.ajax_form("order", "操作订单", '<?php echo $this->_tpl_vars['config']['weburl']; ?>
/admin/module.php?m=product&s=order_opear.php&type='+type+'&orderid='+data.id, 800);
    return false;
    
});
$('.operate').hover(function(){                  
    if ($(this).position().top + $(this).children("ul").height() + $(this).parent("td").height() - $(window).height()- $(window).scrollTop()  < 0) {
        $(this).addClass("hover");
        $(this).children("ul").css("top", "22px");
    } else {
        $(this).addClass("hover-up");
        $(this).children("ul").css("top", -$(this).children("ul").height());
    }
},function(){
    $(this).removeClass("hover").removeClass("hover-up");   
});

//时间搜索
$('.input_cxcalendar').each(function(){
    var a = new Calendar({
        targetCls: $(this),
        type: 'yyyy-mm-dd HH:MM:SS',
        wday:2
    },function(val){
        console.log(val);
    });
});

function printArea(id){
	 var iframe = document.createElement('IFRAME');
     iframe.src='<?php echo $this->_tpl_vars['config']['weburl']; ?>
/admin/module.php?m=logistics&s=print.php&type=expressprint&oid='+id;
     iframe.width='0'
     iframe.height='0'
     document.body.appendChild(iframe);
     var frameWindow = iframe.contentWindow;
     frameWindow.onload=function(){
    	 
    	 frameWindow.document.getElementById("print_btn").style.display="none";
    	 frameWindow.close();
         frameWindow.focus();
         frameWindow.print();

         window.parent.message_confirm("confirm_print", "打印完成", "打印完成？", function(){
            document.body.removeChild(iframe);
             //更新打印状态
             $.get('<?php echo $this->_tpl_vars['config']['weburl']; ?>
/admin/module.php?m=logistics&s=print.php&type=update_express_print_status&oid='+id,function(data){
                 window.parent.main.document.location.reload();
             });
         }, function(){

            document.body.removeChild(iframe);
             printArea(id);
         },300)
     }     
}
</script>    
</div>
</body>
</html>